{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___\n",
    "\n",
    "<a href='https://www.udemy.com/user/joseportilla/'><img src='../Pierian_Data_Logo.png'/></a>\n",
    "___\n",
    "<center><em>Content Copyright by Pierian Data</em></center>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# reduce()\n",
    "\n",
    "Many times students have difficulty understanding reduce() so pay careful attention to this lecture. The function reduce(function, sequence) continually applies the function to the sequence. It then returns a single value. \n",
    "\n",
    "If seq = [ s1, s2, s3, ... , sn ], calling reduce(function, sequence) works like this:\n",
    "\n",
    "* At first the first two elements of seq will be applied to function, i.e. func(s1,s2) \n",
    "* The list on which reduce() works looks now like this: [ function(s1, s2), s3, ... , sn ]\n",
    "* In the next step the function will be applied on the previous result and the third element of the list, i.e. function(function(s1, s2),s3)\n",
    "* The list looks like this now: [ function(function(s1, s2),s3), ... , sn ]\n",
    "* It continues like this until just one element is left and return this element as the result of reduce()\n",
    "\n",
    "Let's see an example:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "113"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from functools import reduce\n",
    "\n",
    "lst =[47,11,42,13]\n",
    "reduce(lambda x,y: x+y,lst)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Lets look at a diagram to get a better understanding of what is going on here:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAADOCAIAAACy8C5XAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB9sMAwwnBcDduy0AACAASURBVHja7V13fFTF9j9zdzebSmihg6gUlS6ioGIlKqIiCEqxUOSB9C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ypXr16GHe/0KF48ODBiDhy5EjDNXk249ChQ6tXr96mTRtjkzxgxYoV77333ldffQVXO/13Rc91DX3UkydPDh069IYbbujcuXNkZGRYUo9+nH379o0YMaJVq1ZmfM5zVOXz+Xr27Nm4ceNnn33WRFV5MOO6devmzp07ceLE/JBOvdKHSYemAwFg9uzZmzZt6tat20033RQ2HTK0VyxatOibb77p37//9ddff9azG/xNSzLz4MGDH3jggXvuuccwTh78cOfOnVOmTBk5cmTRokXzw+h+1U6wD1okJSVl1KhRJUuWfO2118JA74Q+QteuXatWrdq3b1+n02k0Tp6N2a5du+eee+7BBx80NsyDTly1atXkyZM/+eSTqKiofNK/xNVd0x18/pkzZ+7Zs6dfv34lS5Y8r8AuWAInJSXl1Vdfbdu27f33328ETp4dAxE7dOjQsWPH++67zzBOHlxxz549Y8aMmTZtWr5SiCI/bCSh/WnFihVr166tWrVqsP6iAKme0DHkv//977Zt25o1a3bbbbeZrpJnS+bm5g4bNuzee+8NahxjzIuy4e7du999990BAwZUrlw5Xxnw6pNOqDmys7MXLly4bNmyjz/+GApaia2+z7fffrtkyZJPPvlkkSJFTFe5FEt26NChe/fut956qzFjHjROcnJy27ZtFyxYEBcXl99u8urvXBPqT7Gxse3atWvfvn2TJk127typq3hDrZk/21i/ZmZmjh071rKs559/Xrf0hfbiN/hre9q23b9//xYtWhjGyRvS0tJ69eo1b968uLi40E6UTyDy1Q0FefrkyZMzZszweDwDBw4MJsDy87C8evXqxYsXJyYmPvDAA6afXIraTUtLGzVqVJMmTR566CFjwzyYMS0tbciQId26datVq1Y+NSDnPxARMyPi+vXrExMT//jjj7N+lX/uU9/PrFmz+vTpk5qaGryYr+6zQCBotAEDBqxbty70isHftx4zP/nkkzt27Ah2lnxow/yldM4d97xe7wsvvHD77bc/88wzbrf7qieYQ/9dbbpXXnklLi4uPOb7r25bI2KbNm06dOjQrFkzMMs4L9Ihmdnj8Tz77LMvvvhiw4YN83VBUz7nb/1m9uzZffv23bZtW+j1q0XhwVElKSmp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KsN6+gwDJxQaAkKeX/DEkmZES9KkKzFbHmI2JWrBSzQkVAilEyKfTY8eZomkInpc2cZSFWMbxixdc+X+b5XEAAMIANoPcV5eCSCP/+owzA5HA4EImI/3QdgINbVviPqQksp2D/1wFpSuOE0uXuTXz4rHOyDAzpGIQt6cDVPouKAZjZMjLHhFcGhYFxrnpEo0+f+Ytj0Q2M0jEwMDC4VJhlEAYGBoZ0DAwMDOkYGBgYGNIxMDAwpGNgYGBgSMfAwMCQjoGBQSHF/wOTXiCLJ+r2WwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<IPython.core.display.Image object>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.display import Image\n",
    "Image('http://www.python-course.eu/images/reduce_diagram.png')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note how we keep reducing the sequence until a single final value is obtained. Lets see another example:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "#Find the maximum of a sequence (This already exists as max())\n",
    "max_find = lambda a,b: a if (a > b) else b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "47"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Find max\n",
    "reduce(max_find,lst)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Hopefully you can see how useful reduce can be in various situations. Keep it in mind as you think about your code projects!"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
